package com.adms.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.adms.domain.ReformReply;
import com.adms.service.ReformReplyService;

@RequestMapping("reform/reply")
@RestController
public class ReformReplyController {

	@Autowired
	private ReformReplyService reformReplyService;
	
	@GetMapping("{replyId}")
	public Object getByReplyId(@PathVariable("replyId") Integer replyId) {
		return reformReplyService.getByReplyId(replyId);
	}
	
	@GetMapping("getWithReform")
	public Object getByReplyIdWithReform(@RequestParam("replyId") Integer replyId) {
		return reformReplyService.getByReplyIdWithReform(replyId);
	}
	
	@GetMapping
	public Object list(ReformReply reformReply,String timeField,Date start,Date end,String orderByClause,
			@RequestParam(defaultValue = "1") Integer pageNum,
			@RequestParam(defaultValue = "5") Integer pageSize,
			@RequestParam(defaultValue = "5") Integer navigatePages) {
		return reformReplyService.list(reformReply,timeField,start,end,orderByClause,pageNum,pageSize,navigatePages);
	}
	
	@PostMapping("audit")
	public Object audit(@RequestParam("replyId") Integer replyId,
			@RequestParam("reformId") Integer reformId,
			Integer gridAuditState,Integer handleAuditState) {
		return reformReplyService.audit(replyId,reformId,gridAuditState,handleAuditState);
	}

}
